home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / GRAPHICS.SWG / 0079_Making VGA Rain.pas < prev    next >
Pascal/Delphi Source File  |  1994-02-03  |  2KB  |  75 lines

  1. {
  2. It's not often that I post anything but since I started getting into it I
  3. figured I'd post something worth while. Heres some code I wrote to produce some
  4. "blood" rain. It isn't much but it's cool to look at :)
  5.  
  6. {This code is release freely to anyone that wants it. I couldn't care less
  7.  what you do with it. It is being used in my demo so if I see it in yours
  8.  i will find you and kill you. Nemesis 1994}
  9.  
  10. program rain;
  11. var p:integer;
  12.  
  13. function keypressed : boolean; assembler; asm
  14.   mov ah,0bh; int 21h; and al,0feh; end;
  15.  
  16. Procedure RotatePal;
  17. Var a:Word;
  18. Begin
  19.   inc(p);
  20.   port[968]:=35;
  21.   a:=100;
  22.  
  23.   while port[$3da] and 8 <> 0 do;
  24.   while port[$3da] and 8 = 0 do;
  25.  
  26.   while a>1 do
  27.   begin
  28.     port[969]:=1-((a+p) and 60);
  29.     port[969]:=0;
  30.     {If you want a better palette selection and more play then remove
  31.      the above line and replace with the one below. It will allow you
  32.      to get to the blues and greens and yellows but I made mine red so
  33.      did not require those}
  34.     {port[969]:=1-((a+p) and 60);}
  35.     port[969]:=1-((a+p) and 65);
  36.     dec(a);
  37.     end;
  38. end;
  39.  
  40. Procedure makerain;
  41. Var
  42.   x,y,c,d:word;
  43. begin
  44.   d:=1;
  45.   randomize;
  46.   for x:=0 to 320 do
  47.   Begin
  48.     c:=random(65);
  49.     for y:=0 to 200 do
  50.     Begin
  51.       if c>64 then c:=1;
  52.       mem[$a000:x+320*y]:=c+35;
  53.       inc(c,d);
  54.     end;
  55.     d:=random(5)+1;
  56.   end;
  57. end;
  58.  
  59.  
  60. begin
  61. asm
  62.   mov ax,$0013
  63.   int 10h
  64.   end;
  65. makerain;
  66. repeat
  67. RotatePal;
  68. until keypressed;
  69. asm
  70.   mov ax,$0002
  71.   int 10h
  72. end;
  73. end.
  74.  
  75.